<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML>
<HEAD>
<TITLE>80386 Programmer's Reference Manual -- Opcode XLAT</TITLE>
</HEAD>
<BODY STYLE="width:80ch">
<B>up:</B> <A HREF="c17.htm">
Chapter 17 -- 80386 Instruction Set</A><BR>
<B>prev:</B><A HREF="XCHG.htm"> XCHG Exchange Register/Memory with Register</A><BR>
<B>next:</B><A HREF="XOR.htm"> XOR Logical Exclusive OR</A>
<P>
<HR>
<P>
<H1>XLAT/XLATB -- Table Look-up Translation</H1>

<PRE>
D7    XLAT m8    5     Set AL to memory byte DS:[(E)BX + unsigned AL]
D7    XLATB      5     Set AL to memory byte DS:[(E)BX + unsigned AL]
</PRE>

<H2>Operation</H2>

<PRE>
IF AddressSize = 16
THEN
   AL := (BX + ZeroExtend(AL))
ELSE (* AddressSize = 32 *)
   AL := (EBX + ZeroExtend(AL));
FI;
</PRE>

<H2>Description</H2>

XLAT changes the AL register from the table index to the table entry. AL
should be the unsigned index into a table addressed by DS:BX (for an
address-size attribute of 16 bits) or DS:EBX (for an address-size attribute
of 32 bits).
<P>
The operand to XLAT allows for the possibility of a segment override. XLAT
uses the contents of BX even if they differ from the offset of the operand.
The offset of the operand should have been moved intoBX/EBX with a previous
instruction.
<P>
The no-operand form, XLATB, can be used if the BX/EBX table will always
reside in the DS segment.

<H2>Flags Affected</H2>

None

<H2>Protected Mode Exceptions</H2>

#GP(0) for an illegal memory operand effective address in the CS, DS, ES,
FS, or GS segments; #SS(0) for an illegal address in the SS segment;
#PF(fault-code) for a page fault

<H2>Real Address Mode Exceptions</H2>

Interrupt 13 if any part of the operand would lie outside of the effective
address space from 0 to 0FFFFH

<H2>Virtual 8086 Mode Exceptions</H2>

Same exceptions as in Real Address Mode; #PF(fault-code) for a page fault


<P>
<HR>
<P>
<B>up:</B> <A HREF="c17.htm">
Chapter 17 -- 80386 Instruction Set</A><BR>
<B>prev:</B><A HREF="XCHG.htm"> XCHG Exchange Register/Memory with Register</A><BR>
<B>next:</B><A HREF="XOR.htm"> XOR Logical Exclusive OR</A>
</BODY>
